
import React, {Component} from 'react';
import {Text, View, Image, 
  StyleSheet,Dimensions
} from 'react-native';
import Swiper from 'react-native-swiper';
const {width} = Dimensions.get('window');
export default class MySwiper extends Component{
  render(){
    let imgList = this.props.imgList || []
    return(
      <View style={styles.swiper}>
        <Swiper style={styles.wrapper} showsButtons={false} autoplay={true} height={150}>
          {
            imgList.map((item,index) => {
              return(
                <View style={styles.slide} key={index}>
                  <Image resizeMode='stretch' style={styles.swiperImg} source={item.img}/>
                </View>
              )
            })
          }
        </Swiper>
      </View>
    )
  }
}
const styles = StyleSheet.create({
  swiperImg:{
    width,
    flex:1,
  },
  slide: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: 'transparent',
  },
  swiper:{
    height:150,
    width:'100%',
  }
})